<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="referrer" content="no-referrer" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>ShloreX热点聚合平台</title>
    <style>
        /* 增强样式 */
        /* 作者信息样式 */
        .author-info {
            display: flex;
            align-items: center;
            margin: 8px 0;
            gap: 10px;
        }

        .author-avatar {
            width: 32px;
            height: 32px;
            border-radius: 50%;
            object-fit: cover;
        }

        .author-detail {
            font-size: 14px;
        }

        .author-mid {
            font-size: 12px;
            color: #666;
        }

        /* B站特殊样式 */
        [data-type="biliall"] .cover-wrapper {
            border-radius: 8px;
        }

        .bili-extra {
            margin-top: 10px;
            padding: 10px;
            background: #f8f9fa;
            border-radius: 6px;
        }

        /* 少数派特殊样式 */
        [data-type="sspai"] .hotspot-title {
            color: #d7191a;
        }

        .sspai-text {
            border-left: 3px solid #d7191a;
            padding-left: 10px;
            margin: 10px 0;
            color: #666;
        }

        /* 排名样式 */
        .rank {
            display: inline-block;
            width: 24px;
            height: 24px;
            line-height: 24px;
            text-align: center;
            background: var(--primary-color);
            color: white;
            border-radius: 4px;
            margin-right: 8px;
        }
    </style>
    <style>
        /* 基础样式 */
        body {
            margin: 0;
            font-family: system-ui, sans-serif;
            background: #f8f9fa;
        }

        .container {
            max-width: 800px;
            margin: 20px auto;
            padding: 0 15px;
        }

        /* 通用卡片样式 */
        .hotspot-card {
            background: white;
            border-radius: 12px;
            margin-bottom: 15px;
            padding: 15px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
            position: relative;
            overflow: hidden;
        }

        /* 类型主题色系统 */
        .hotspot-card[data-type="baidu"] {
            border-left: 4px solid #2932e1;
        }

        .hotspot-card[data-type="history"] {
            border-left: 4px solid #6c757d;
        }

        .hotspot-card[data-type="sp"] {
            border-left: 4px solid #dc3545;
        }

        .hotspot-card[data-type="acg"] {
            border-left: 4px solid #ff69b4;
        }

        .hotspot-card[data-type="movie"] {
            border-left: 4px solid #20c997;
        }

        .hotspot-card[data-type="tv"] {
            border-left: 4px solid #fd7e14;
        }

        .hotspot-card[data-type="vs"] {
            border-left: 4px solid #ffd700;
        }

        .hotspot-card[data-type="weibo"] {
            border-left: 4px solid #e6162d;
        }

        .hotspot-card[data-type="douyin"] {
            border-left: 4px solid #000;
        }

        .hotspot-card[data-type="zhihu"] {
            border-left: 4px solid #0084ff;
        }

        .hotspot-card[data-type="sspai"] {
            border-left: 4px solid #d7191a;
        }

        .hotspot-card[data-type="biliall"] {
            border-left: 4px solid #00a1d6;
        }

        .hotspot-card[data-type="bilihot"] {
            border-left: 4px solid #fb7299;
        }

        /* 类型图标系统 */
        .type-badge {
            position: absolute;
            right: 15px;
            top: 15px;
            font-size: 12px;
            padding: 4px 8px;
            border-radius: 4px;
            background: rgba(0, 0, 0, 0.7);
            color: white;
            display: flex;
            align-items: center;
        }

        .type-badge::before {
            content: '';
            display: inline-block;
            width: 16px;
            height: 16px;
            margin-right: 6px;
            background-size: contain;
        }

        [data-type="baidu"] .type-badge::before {
            background-image: url(https://www.baidu.com/favicon.ico);
        }

        [data-type="weibo"] .type-badge::before {
            background-image: url(https://weibo.com/favicon.ico);
        }

        [data-type="douyin"] .type-badge::before {
            background-image: url(https://www.douyin.com/favicon.ico);
        }

        [data-type="zhihu"] .type-badge::before {
            background-image: url(https://www.zhihu.com/favicon.ico);
        }

        [data-type="biliall"] .type-badge::before,
        [data-type="bilihot"] .type-badge::before {
            background-image: url(https://www.bilibili.com/favicon.ico);
        }

        /* 差异化内容样式 */
        /* 影视类 */
        [data-type="movie"] .media-info,
        [data-type="tv"] .media-info {
            display: flex;
            gap: 15px;
            color: #666;
            font-size: 14px;
            margin: 8px 0;
        }

        /* 短剧特殊样式 */
        [data-type="sp"] .count {
            background: #ffeef0;
            color: #dc3545;
            padding: 2px 6px;
            border-radius: 4px;
        }

        /* 动漫类 */
        [data-type="acg"] .cover-wrapper {
            border-radius: 16px;
            overflow: hidden;
        }

        /* 通用内容样式 */
        .cover-wrapper {
            width: 120px;
            height: 80px;
            border-radius: 8px;
            overflow: hidden;
            float: left;
            margin-right: 15px;
        }

        .cover-image {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }

        .hotspot-title {
            font-size: 16px;
            color: #333;
            text-decoration: none;
            margin-bottom: 8px;
            display: block;
        }

        .hotspot-desc {
            font-size: 14px;
            color: #666;
            line-height: 1.5;
            margin: 8px 0;
        }

        .meta-info {
            font-size: 12px;
            color: #999;
            display: flex;
            gap: 15px;
        }
    </style>
</head>

<body>
    <div class="container">
        <div id="hotspotList"></div>
        <div id="loading" class="loading">加载中...</div>
    </div>

    <script>
        // URL参数获取
        function getUrlParam(name) {
            const params = new URLSearchParams(window.location.search);
            return params.get(name);
        }

        const type = getUrlParam('type') || 'baidu';
        const config = {
            apiUrl: `https://xzdx.top/api/tophub/?type=${type}`,
            pageSize: 20,
            currentPage: 1
        };

        // 类型映射表
        const typeMap = {
            baidu: '百度热点',
            history: '历史今天',
            sp: '热门短剧',
            acg: '动漫推荐',
            movie: '电影推荐',
            tv: '电视剧集',
            vs: '综艺节目',
            weibo: '微博热搜',
            douyin: '抖音热榜',
            zhihu: '知乎热榜',
            sspai: '少数派',
            biliall: '哔哩全站',
            bilihot: '哔哩热搜'
        };

        // 加载数据
        async function loadData() {
            try {
                const response = await fetch(config.apiUrl);
                const { code, data } = await response.json();

                if (code === 0 && data.length) {
                    renderHotspots(data);
                }
            } catch (error) {
                console.error('加载失败:', error);
            }
        }

        // 渲染内容
        function renderHotspots(list) {
            const container = document.getElementById('hotspotList');

            list.forEach(item => {
                const card = document.createElement('div');
                card.className = 'hotspot-card';
                card.dataset.type = type;  // 设置数据类型属性

                let extraInfo = '';
                // 根据类型生成额外信息
                switch (type) {
                    case 'movie':
                    case 'tv':
                        extraInfo = `
                            <div class="media-info">
                                ${item.year ? `<span>📅 ${item.year}</span>` : ''}
                                ${item.avg ? `<span>⭐ ${item.avg}</span>` : ''}
                                ${item.count ? `<span>🎬 全${item.count}集</span>` : ''}
                            </div>
                        `;
                        break;
                    case 'sp':
                        extraInfo = `
                            <div class="meta-info">
                                ${item.count ? `<span class="count">已更新${item.count}</span>` : ''}
                            </div>
                        `;
                        break;
                    case 'history':
                        extraInfo = `
                            <div class="meta-info">
                                ${item.date ? `<span>🗓️ ${item.date}</span>` : ''}
                            </div>
                        `;
                        break;
                }

                card.innerHTML = `
                    <div class="type-badge">
                        <span>${typeMap[type]}</span>
                    </div>
                    <div class="cover-wrapper">
                        <img class="cover-image" 
                            src="${item.cover}" 
                            alt="${item.title}"
                            loading="lazy"
                            onerror="this.style.display='none'"
                        >
                    </div>
                    <a href="${item.url}" target="_blank" class="hotspot-title">${item.title}</a>
                    ${item.author ? `<div class="author">👤 ${item.author}</div>` : ''}
                    ${item.desc ? `<div class="hotspot-desc">${item.desc}</div>` : ''}
                    <div class="meta-info">
                        ${item.heat ? `<span>🔥 ${item.heat}</span>` : ''}
                        ${item.area ? `<span>📍 ${item.area}</span>` : ''}
                        ${item.channel ? `<span>📌 ${item.channel}</span>` : ''}
                    </div>
                    ${extraInfo}
                `;
                if (type == "biliall") {
                    card.innerHTML = `
                    <div class="type-badge">
                        <span>${typeMap[type]}</span>
                    </div>
                    <div class="cover-wrapper">
                        <img class="cover-image"
                            referrer="no-referrer|origin|unsafe-url" 
                            src="${item.cover}" 
                            alt="${item.title}"
                            loading="lazy"
                            onerror="this.style.display='none'"
                        >
                    </div>
                    <a href="${item.url}" target="_blank" class="hotspot-title">${item.title}</a>
                    ${item.author.name ? `<div class="author">👤 ${item.author.name}</div>` : ''}
                    ${item.desc ? `<div class="hotspot-desc">${item.desc}</div>` : ''}
                    <div class="meta-info">
                        ${item.heat ? `<span>🔥 ${item.heat}</span>` : ''}
                        ${item.area ? `<span>📍 ${item.area}</span>` : ''}
                        ${item.type ? `<span>📌 ${item.type}</span>` : ''}
                    </div>
                    ${extraInfo}
                `;
                }else if (type == "sspai") {
                    card.innerHTML = `
                    <div class="type-badge">
                        <span>${typeMap[type]}</span>
                    </div>
                    <div class="cover-wrapper">
                        <img class="cover-image"
                            src="https://cdnfile.sspai.com/${item.cover}" 
                            alt="${item.title}"
                            loading="lazy"
                            load="javascript:"
                            onerror="this.style.display='none'"
                        >
                    </div>
                    <a href="${item.url}" target="_blank" class="hotspot-title">${item.title}</a>
                    ${item.author.name ? `<div class="author">👤 ${item.author.name}</div>` : ''}
                    ${item.desc ? `<div class="hotspot-desc">${item.desc}</div>` : ''}
                    <div class="meta-info">
                        ${item.area ? `<span>📍 ${item.area}</span>` : ''}
                    </div>
                    ${extraInfo}
                `;
                }
                container.appendChild(card);
            });
        }

        // 初始化加载
        loadData();
    </script>


</body>

</html>